package com.youpai.platform.user.web.api;

import com.youpai.platform.common.entity.resp.BaseResponse;
import com.youpai.platform.user.service.service.UserFollowService;
import com.youpai.platform.user.service.service.UserService;
import com.youpai.platform.user.web.entity.dto.UserFollowDTO;
import com.youpai.platform.user.web.entity.req.*;
import com.youpai.platform.user.web.entity.resp.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @Description: 用户相关controller
 * @Author:welles
 * @Date:2022/7/23
 */
@Slf4j
@RestController
@RequestMapping(value = "/user")
@Api(value = "UserFollowController", tags = "用户关注相关")
public class UserFollowController {

    @Resource
    private UserFollowService userFollowService;

    @ApiOperation(value = "关注或取消用户")
    @PostMapping(value = "/follow")
    public BaseResponse<UserResp> followUser(@RequestBody UserFollowReq req) {
        return BaseResponse.success(userFollowService.followUser(req));
    }

    @ApiOperation(value = "获取关注列表")
    @PostMapping(value = "/followList")
    public BaseResponse<List<UserFollowDTO>> getFollowList(@RequestBody UserFollowListReq req) {
        return BaseResponse.success(userFollowService.getFollowUserList(req));
    }

    @ApiOperation(value = "获取粉丝列表")
    @PostMapping(value = "/fans")
    public BaseResponse<List<UserFollowDTO>> getFansList(@RequestBody UserFollowListReq req) {
        return BaseResponse.success(userFollowService.getBeFollowUserList(req));
    }

}
